home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Programming Sound Cards
/
Programming Sound Cards.iso
/
sound_06
/
outchip.asm
< prev
next >
Wrap
Assembly Source File
|
1995-01-01
|
2KB
|
134 lines
; OUTCHIP.ASM
; Adlib Inc, 20-avr-89
INCLUDE VERSION.INC ;*** compilation flags are defined in this file ***
IF MICROSOFT
INCLUDE CMICRO.MAC ;memory model & equates for Microsoft environment
ELSE
INCLUDE DOS.MAC ;memory model & equates for Lattice environment
ENDIF
INCLUDE COMMON.MAC ;macros common to both environments
; ========================= DATA SEGMENT =========================
; data segment
DSEG
IF MICROSOFT
extrn _genAddr:WORD ; address of sound chip.
ELSE
extrn genAddr:WORD ; address of sound chip.
ENDIF
ENDDS
;========================== CODE SEGMENT ============================
IF MICROSOFT
PSEG <TIMER>
ELSE
PSEG
ENDIF
; void SndOutput( addr, dataVal)
; int addr, dataVal;
;
; Set the register at address 'addr' to the value 'data'.
; Take care of data register to data register write delay.
BEGIN SndOutput
SO_F struc
dw (?) ; old bp
db CPSIZE DUP (?) ; return addr
addr dw (?) ; register adress in sound chip
dataVal dw (?) ; data to be written
SO_F ends
; AX & DX lost.
push bp
mov bp, sp
IF MICROSOFT
mov dx, _genAddr ; get address register of sound chip
ELSE
mov dx, genAddr ; get address register of sound chip
ENDIF
mov ax, [ bp].addr
out dx, al
; 12 cyles delay ( 3.6 Mhz )
in al, dx
in al, dx
in al, dx
in al, dx
in al, dx
in al, dx
inc dx ; get data reg. of sound chip
mov ax, [ bp].dataVal
out dx, al
dec dx
; 84 cyles delay ( 3.6 Mhz )
in al, dx
in al, dx
in al, dx
in al, dx
in al, dx
in al, dx
in al, dx
in al, dx
in al, dx
in al, dx
in al, dx
in al, dx
in al, dx
in al, dx
in al, dx
in al, dx
in al, dx
in al, dx
in al, dx
in al, dx
in al, dx
in al, dx
in al, dx
in al, dx
in al, dx
in al, dx
in al, dx
in al, dx
in al, dx
in al, dx
in al, dx
in al, dx
in al, dx
in al, dx
in al, dx
pop bp
ret
P_END SndOutput
IF MICROSOFT
ENDPS <TIMER>
ELSE
ENDPS
ENDIF
end